package com.zc.zby.basicframedemo.viewholder;

import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.zc.zby.basicframedemo.R;
import com.zc.zby.basicframedemo.model.CellModel;
import com.zc.zby.basicframedemo.utils.ToolUtil;

public class CellViewHolder extends BaseViewHolder<CellModel> {

    private TextView mTvCell;
    private LinearLayout mCellLayout;

    public CellViewHolder(View view) {
        super(view);
        mTvCell = $(R.id.cell_content);
        mCellLayout = $(R.id.cell_layout);
        ViewGroup.LayoutParams layoutParams = mCellLayout.getLayoutParams();
        layoutParams.width = ToolUtil.dip2px(getContext(), 80);
        layoutParams.height = ToolUtil.dip2px(getContext(), 50);
        mCellLayout.setLayoutParams(layoutParams);
        ViewGroup.LayoutParams layoutParams1 = mTvCell.getLayoutParams();
        layoutParams1.width = ToolUtil.dip2px(getContext(), 80);
        layoutParams1.height = ToolUtil.dip2px(getContext(), 50);
        mTvCell.setLayoutParams(layoutParams1);
    }

    @Override
    public void setData(CellModel data) {
        super.setData(data);
        mTvCell.setText("内容 " + getAdapterPosition());
    }
}
